﻿#include <QQmlEngine>

#include "QtMapWidget.h"
#include "Qml/MapWidgetGlobalQml.h"
#include "Qml/AppSettings.h"
#include "Qml/MapModel.h"
#include "Qml/TrajectoryPoints.h"
#include "Qml/FileDialogHelper.h"
#include "CustomLocationPlugin/QMLControl/MapEngineManager.h"


static QObject* mapWidgetGlobalQmlSingletonFactory(QQmlEngine*, QJSEngine*)
{
    return mapWidgetGlobalQml();
}

void initQtMapWidget()
{
    qmlRegisterType<FileDialogHelper>("FileDialogHelper", 1, 0, "FileDialogHelper");

    qmlRegisterUncreatableType<AppSettings>         ("MapWidgetGlobal",            1, 0,   "AppSettings",        "Reference only");
    qmlRegisterUncreatableType<MapModel>            ("MapWidgetGlobal",            1, 0,   "MapModel",           "Reference only");
    qmlRegisterUncreatableType<MapEngineManager>    ("MapWidgetGlobal",            1, 0,   "MapEngineManager",   "Reference only");
    qmlRegisterUncreatableType<TrajectoryPoints>    ("MapWidgetGlobal.MapModel",   1, 0,   "TrajectoryPoints",   "Reference only");

    qmlRegisterSingletonType<MapWidgetGlobalQml>("MapWidgetGlobal", 1, 0, "MapWidgetGlobal", mapWidgetGlobalQmlSingletonFactory);
}
